/*
 * @Author: Vorga
 * @LastEditors: Vorga
 */
#ifndef HEAP_TREE_H
#define HEAP_TREE_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

#define swap(a,b) do{typeof(a) t=a;a=b;b=t;}while(0)

typedef int (*CMP)(const void*, const void*);
typedef void (*FUNC)(void*);

typedef struct Heap
{
    void** arr;
    size_t size;
    size_t cnt;
    CMP cmp;
} Heap;

Heap* create_ht(size_t size);

bool empty_ht(Heap* heap);

bool full_ht(Heap* heap);

void traversal_ht(Heap* heap, FUNC show);

void* top_ht(Heap* heap);

bool pop_ht(Heap* heap);

bool push_ht(Heap* heap, void* data);

bool sort_ht(Heap* heap);

void destory_ht(Heap* heap);

void set_cmp_ht(Heap* heap, CMP cmp);
#endif // HEAP_TREE_H
